﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Perst;

namespace skiordiecore
{
    public class Championship : Persistent
    {
        public int id;
        public String name { get; set; }
        public DateTime eventDate { get; set; }

        private readonly IList<Participant> _participants = new List<Participant>();

        public Championship(String name, DateTime eventDate)
        {
            this.name = name;
            this.eventDate = eventDate;
        }

        public IEnumerable<Participant> Participants
        {
            get { return _participants; }
        }

        /// <summary>
        /// Adds Participant object instance to the Participant list and adds a reverse reference to Championship.
        /// </summary>
        /// <param name="participant"></param>
        public void AddParticipant(Participant participant)
        {
            if (_participants.Contains(participant)) return;
            _participants.Add(participant);
           // participant.AddChampionship(this);
        }
    }

}
